package starter.context;

import java.io.File;
import java.util.Map;

import com.bowlong.io.FileEx;
import com.bowlong.third.FastJSON;
import com.bowlong.tool.Lib2;
import com.bowlong.util.Log;

@SuppressWarnings({ "unchecked" })
public abstract class JSONContext extends Lib2 {
	protected static final File CONFIG = new File("app.json");

	static Map<String, Object> ctx = null;

	public static Map<String, Object> ctx() {
		try {
			if (ctx == null) {
				String text = FileEx.readText(CONFIG);
				ctx = FastJSON.parseMap(text);
			}
		} catch (Exception e) {
			Log.error(e2s(e));
		}
		return ctx;
	}

	// ////////////////////////////////////////////////////////

}
